﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace EpiNEXT.WPF.FormDesigner
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void Forms_BackButtonClicked(object sender, EventArgs args)
        {
            pageForms.Visibility = System.Windows.Visibility.Collapsed;
            pageHome.Visibility = System.Windows.Visibility.Visible;

            grdGettingStarted.Visibility = System.Windows.Visibility.Visible;
            // TODO: Move this to custom controls
        }

        private void Forms_FormOpened(object sender, Core.Events.FormOpenedEventArgs args)
        {
            //grdIntro.Visibility = System.Windows.Visibility.Collapsed;
            ProjectViewModel vm = this.DataContext as ProjectViewModel;
            vm.LoadFormCommand.Execute(args.FormInfo);
            // TODO: Move this to custom controls
        }

        private void Home_ProjectOpened(object sender, Core.Events.ProjectOpenedEventArgs args)
        {
            pageHome.Visibility = System.Windows.Visibility.Collapsed;
            pageForms.DataContext = args.ProjectInfo;
            pageForms.Visibility = System.Windows.Visibility.Visible;

            grdGettingStarted.Visibility = System.Windows.Visibility.Collapsed;
            // TODO: Move this to custom controls
        }
    }
}
